package com.jxbai.design.pattern.dcxy.singleton;

/**
 * 懒汉式单例
 * @author jxbai
 * @date 2021/12/13
 */
public class LazySingleton {

    private static volatile LazySingleton instance;

    private LazySingleton() {

    }

    public static synchronized LazySingleton getInstance() {
        if (instance == null) {
            instance = new LazySingleton();
        }
        return instance;
    }
}
